#include <util\AutomaticInstallation.au3>

Global $InstallProgramPath = "C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe"
Global $InstallFolder      = "C:\Program Files\Foxit Software\Foxit Reader"
Global $SetupFile = "FoxitReader331_enu_Setup.exe"
Global $UninstallPath = "C:\Program Files\Foxit Software\Foxit Reader\Uninstall.exe"

Main($InstallProgramPath, $InstallFolder, $SetupFile, $UninstallPath)

Func InstallImpl($SetupPath) 
	Dim $Title = ""
	
	RunSetupFile($SetupPath)

	$Title = "Foxit Reader Install Wizard"
	$Text = "Many More"
	WinWaitActive($Title, $Text)
	Send("!N")
	Sleep($SleepDelay)
	
	$Text = "Please read the license terms below before installing."
	WinWaitActive($Title, $Text)
	Send("!N")
	Sleep($SleepDelay)
	
	$Text = "&Default"
	WinWaitActive($Title, $Text)
	Send("!D")
	Sleep($SleepDelay)	
	
	$Text = "&Install"
	WinWaitActive($Title, $Text)
	Send("!I")
	Sleep($SleepDelay)
	
	$Text = "&Finish"
	WinWaitActive($Title, $Text)
	Send("{SPACE}")
	Send("{DOWN}")
	Send("{DOWN}")
	Send("{SPACE}")
	Send("!F")	
	
	WinWaitClose($Title)

	Return True
EndFunc

Func UninstallImpl($UninstallPath)
	Dim $Title = ""
	Run($UninstallPath)
	
	$Title = "Uninstall Foxit Reader"
	$Text = "Are you sure you want to uninstall Foxit Reader?"
	WinWaitActive($Title, $Text)
	Send("!Y")
	Sleep($SleepDelay)

	$Text = "You have successfully removed Foxit Reader."
	WinWaitActive($Title, $Text)
	Send("{Enter}")

	Return True
EndFunc




